import { defHttp } from '/@/utils/http/axios';
import { ApiCommon } from '../common';

const {
  PAPERINSTALL_API,
  METER_ADMIN_DICT_API,
  ADMIN_USER_DICT_API,
  BILLING_ADMIN_API,
  CUSTOMER_ADMIN_API,
  SYS_ADMIN_API,
} = ApiCommon;
const ADMIN_USER_REGION_DICT_API = `${ADMIN_USER_DICT_API}/region`;

enum API {
  USER_INFO = '/user/info', // 综合业务办理查询账户列表
  INFO = '/user-water-usage/get/info', // 获得用户用水类别
  APPLIATION_FLOW = '/admin/install/appliation/flow',
  CUSTOMER_SERVICE_CHECK = '/admin/customer-service-check',

  DIAMETER_LIST = '/diameter/listByKeyword',
  START = '/capacity-change/flow/start',
  CAPACITY_INFO = '/capacity-change/info',
  WATER_ITEM_LSIT = '/water-item/list',
  LISTBYROLECODE = '/user/listByRoleCode',
  DIA_LIST = '/diameter/list',
  WATER_SELECTOR = '/water-usage/get/selector',
  USAGE_METER = '/usage/get/all',
  LIST = '/list', //省市区联动对应表 | 获取表册通用,
  CONSTRUCTION_ORGANIZATION = '/admin/construction-organization',
  YS_INFO = '/admin/install/appliation/water-url',
  // 打印施工单
  CONSTR_INFO = '/capacity-change/construction/info',
  // 管理区域
  DEPT_GET = '/dept/get-dept',
  GEN_CODE = '/gen/change-code/WKCX',
}

export const getDiameterList = (params: object) =>
  defHttp.get({ url: METER_ADMIN_DICT_API + API.DIAMETER_LIST, params });

// 不用传关键词
export const getDiameterListApi = (params: object) =>
  defHttp.get({ url: METER_ADMIN_DICT_API + API.DIA_LIST, params });

export const getUserInfoApi = (params: object) =>
  defHttp.get({ url: CUSTOMER_ADMIN_API + API.USER_INFO, params }); // 综合业务办理查询账户列表

// 获取用户用水类别
export const getUserWaterApi = (params) =>
  defHttp.get({ url: CUSTOMER_ADMIN_API + API.INFO, params });
// 开始流程
export const startApi = (data) => defHttp.post({ url: CUSTOMER_ADMIN_API + API.START, data });
// 详情
export const getCapacityInfo = (params) =>
  defHttp.get({ url: CUSTOMER_ADMIN_API + API.CAPACITY_INFO, params });

export const listByRoleCodeGetApi = (params: Recordable) =>
  defHttp.get({ url: SYS_ADMIN_API + API.LISTBYROLECODE, params }); //角色查询

export const waterSelectorGetApi = () =>
  defHttp.get({ url: BILLING_ADMIN_API + API.WATER_SELECTOR }); //用水性质

export const usageMeterAllGetApi = () =>
  defHttp.get({ url: METER_ADMIN_DICT_API + API.USAGE_METER }); //水表用途

//省市区联动对应表
export const regionListApi = (params: object) =>
  defHttp.get({ url: ADMIN_USER_REGION_DICT_API + API.LIST, params });

export const constructionOrganizationGetApi = (params: Indexable) =>
  defHttp.get({ url: PAPERINSTALL_API + API.CONSTRUCTION_ORGANIZATION, params }); //施工单位列表

export const getYsInfoApi = (id: string | number) =>
  defHttp.get({ url: PAPERINSTALL_API + API.YS_INFO + '/' + id }); //报装查询用水地址

export const customerServiceCheckGetApi = (id: string | number) =>
  defHttp.get({ url: PAPERINSTALL_API + API.CUSTOMER_SERVICE_CHECK + '/' + id }); //客服验收info

export const getConstrInfo = (params) =>
  defHttp.get({ url: CUSTOMER_ADMIN_API + API.CONSTR_INFO, params }); //打印施工单信息获取

export const deptGetApi = async () => defHttp.get({ url: SYS_ADMIN_API + API.DEPT_GET }); //管理区域

export const genCode = async () => defHttp.get({ url: CUSTOMER_ADMIN_API + API.GEN_CODE }); //获取工程编号
